home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / command.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-02  |  7.0 KB  |  212 lines

  1. /* Header file for command-reading library command.c.
  2.    Copyright (C) 1986, 1989, 1990 Free Software Foundation, Inc.
  3.  
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. #if !defined (COMMAND_H)
  19. #define COMMAND_H 1
  20.  
  21. /* Not a set/show command.  Note that some commands which begin with
  22.    "set" or "show" might be in this category, if their syntax does
  23.    not fall into one of the following categories.  */
  24. typedef enum cmd_types {
  25.   not_set_cmd,
  26.   set_cmd,
  27.   show_cmd
  28. } cmd_types;
  29.  
  30. /* Types of "set" or "show" command.  */
  31. typedef enum var_types {
  32.   /* "on" or "off".  *VAR is an integer which is nonzero for on,
  33.      zero for off.  */
  34.   var_boolean,
  35.   /* Unsigned Integer.  *VAR is an unsigned int.  The user can type 0
  36.      to mean "unlimited", which is stored in *VAR as UINT_MAX.  */
  37.   var_uinteger,
  38.   /* String which the user enters with escapes (e.g. the user types \n and
  39.      it is a real newline in the stored string).
  40.      *VAR is a malloc'd string, or NULL if the string is empty.  */
  41.   var_string,
  42.   /* String which stores what the user types verbatim.
  43.      *VAR is a malloc'd string, or NULL if the string is empty.  */
  44.   var_string_noescape,
  45.   /* String which stores a filename.
  46.      *VAR is a malloc'd string, or NULL if the string is empty.  */
  47.   var_filename,
  48.   /* ZeroableInteger.  *VAR is an int.  Like Unsigned Integer except
  49.      that zero really means zero.  */
  50.   var_zinteger
  51. } var_types;
  52.  
  53. /* This structure records one command'd definition.  */
  54.  
  55. struct cmd_list_element
  56.   {
  57.     /* Points to next command in this list.  */
  58.     struct cmd_list_element *next;
  59.  
  60.     /* Name of this command.  */
  61.     char *name;
  62.  
  63.     /* Command class; class values are chosen by application program.  */
  64.     enum command_class class;
  65.  
  66.     /* Function definition of this command.
  67.        Zero for command class names and for help topics that
  68.        are not really commands.  */
  69.     union {
  70.     void (*cfunc) PARAMS ((char *args, int from_tty));
  71.     void (*sfunc) PARAMS ((char *args, int from_tty,
  72.                    struct cmd_list_element *c));
  73.     } function;
  74. #   define NO_FUNCTION ((void (*) PARAMS((char *args, int from_tty))) 0)
  75.  
  76.     /* Documentation of this command (or help topic).
  77.        First line is brief documentation; remaining lines form, with it,
  78.        the full documentation.  First line should end with a period.
  79.        Entire string should also end with a period, not a newline.  */
  80.     char *doc;
  81.  
  82.     /* Auxiliary information.
  83.        It is up to the calling program to decide what this means.  */
  84.     char *aux;
  85.  
  86.     /* Nonzero identifies a prefix command.  For them, the address
  87.        of the variable containing the list of subcommands.  */
  88.     struct cmd_list_element **prefixlist;
  89.  
  90.     /* For prefix commands only:
  91.        String containing prefix commands to get here: this one
  92.        plus any others needed to get to it.  Should end in a space.
  93.        It is used before the word "command" in describing the
  94.        commands reached through this prefix.  */
  95.     char *prefixname;
  96.  
  97.     /* For prefix commands only:
  98.        nonzero means do not get an error if subcommand is not
  99.        recognized; call the prefix's own function in that case.  */
  100.     char allow_unknown;
  101.  
  102.     /* Nonzero says this is an abbreviation, and should not
  103.        be mentioned in lists of commands.
  104.        This allows "br<tab>" to complete to "break", which it
  105.        otherwise wouldn't.  */
  106.     char abbrev_flag;
  107.  
  108.     /* Completion routine for this command.  */
  109.     char ** (*completer) PARAMS ((char *text));
  110.  
  111.     /* Type of "set" or "show" command (or SET_NOT_SET if not "set"
  112.        or "show").  */
  113.     cmd_types type;
  114.  
  115.     /* Pointer to variable affected by "set" and "show".  Doesn't matter
  116.        if type is not_set.  */
  117.     char *var;
  118.  
  119.     /* What kind of variable is *VAR?  */
  120.     var_types var_type;
  121.  
  122.     /* Pointer to command strings of user-defined commands */
  123.     struct command_line *user_commands;
  124.   };
  125.  
  126. /* Forward-declarations of the entry-points of command.c.  */
  127.  
  128. extern struct cmd_list_element *
  129. add_cmd PARAMS ((char *, enum command_class, void (*fun) (char *, int),
  130.          char *, struct cmd_list_element **));
  131.  
  132. extern struct cmd_list_element *
  133. add_alias_cmd PARAMS ((char *, char *, enum command_class, int,
  134.                struct cmd_list_element **));
  135.  
  136. extern struct cmd_list_element *
  137. add_prefix_cmd PARAMS ((char *, enum command_class, void (*fun) (char *, int),
  138.             char *, struct cmd_list_element **, char *, int,
  139.             struct cmd_list_element **));
  140.  
  141. extern struct cmd_list_element *
  142. add_abbrev_prefix_cmd PARAMS ((char *, enum command_class,
  143.                    void (*fun) (char *, int), char *,
  144.                    struct cmd_list_element **, char *, int,
  145.                    struct cmd_list_element **));
  146.  
  147. extern struct cmd_list_element *
  148. lookup_cmd PARAMS ((char **, struct cmd_list_element *, char *, int, int));
  149.  
  150. extern struct cmd_list_element *
  151. lookup_cmd_1 PARAMS ((char **, struct cmd_list_element *,
  152.               struct cmd_list_element **, int));
  153.  
  154. extern void
  155. add_com PARAMS ((char *, enum command_class, void (*fun)(char *, int),
  156.          char *));
  157.  
  158. extern void
  159. add_com_alias PARAMS ((char *, char *, enum command_class, int));
  160.  
  161. extern void
  162. add_info PARAMS ((char *, void (*fun) (char *, int), char *));
  163.  
  164. extern void
  165. add_info_alias PARAMS ((char *, char *, int));
  166.  
  167. extern char **
  168. complete_on_cmdlist PARAMS ((struct cmd_list_element *, char *));
  169.  
  170. extern void
  171. delete_cmd PARAMS ((char *, struct cmd_list_element **));
  172.  
  173. extern void
  174. help_cmd PARAMS ((char *, FILE *));
  175.  
  176. extern void
  177. help_list PARAMS ((struct cmd_list_element *, char *, enum command_class,
  178.            FILE *));
  179.  
  180. extern void
  181. help_cmd_list PARAMS ((struct cmd_list_element *, enum command_class, char *,
  182.                int, FILE *));
  183.  
  184. extern struct cmd_list_element *
  185. add_set_cmd PARAMS ((char *, enum command_class, var_types, char *, char *,
  186.              struct cmd_list_element **));
  187.  
  188. extern struct cmd_list_element *
  189. add_show_from_set PARAMS ((struct cmd_list_element *,
  190.                struct cmd_list_element **));
  191.  
  192. /* Do a "set" or "show" command.  ARG is NULL if no argument, or the text
  193.    of the argument, and FROM_TTY is nonzero if this command is being entered
  194.    directly by the user (i.e. these are just like any other
  195.    command).  C is the command list element for the command.  */
  196.  
  197. extern void
  198. do_setshow_command PARAMS ((char *, int, struct cmd_list_element *));
  199.  
  200. /* Do a "show" command for each thing on a command list.  */
  201.  
  202. extern void
  203. cmd_show_list PARAMS ((struct cmd_list_element *, int, char *));
  204.  
  205. extern void
  206. error_no_arg PARAMS ((char *));
  207.  
  208. extern void
  209. dont_repeat PARAMS ((void));
  210.  
  211. #endif /* !defined (COMMAND_H) */
  212.